<template>
    <div style="height: 100%; width: 100%; position: relative">
        <div :class="!is_showselother ? 'pagetop' : 'pagetopother'">
            <div style="width: 100%">
                <div style="float: left">
                    <table style="font-size: 12px; white-space: nowrap" class="table1style" border="0">
                        <tr>
                            <td align="right" width="60">签收时间</td>
                            <td>
                                <el-date-picker v-model="searchObj.rcv_startdt" :clearable="false" type="datetime"
                                    placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" style="width: 176px">
                                </el-date-picker>
                                至
                                <el-date-picker v-model="searchObj.rcv_enddt" type="datetime" :clearable="false"
                                    placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" style="width: 176px">
                                </el-date-picker>
                            </td>
                            <td align="right" width="60">签收用户</td>
                            <td>
                                <rm-ddl-common @change="userinfochange" datatype="userinfo" kindno="1" dataname="用户"
                                    v-model="searchObj.txtuser" width="150px"></rm-ddl-common>
                            </td>
                            <td align="right" width="60">条码号</td>
                            <td>
                                <el-input v-model.trim="searchObj.txtbarcode" @keyup.enter.native="InitPage" clearable
                                    style="width: 150px" ref="searchbarcode"></el-input>
                            </td>

                            <td align="right" width="60">申请科室</td>
                            <td>
                                <rm-ddl-common @change="REQdeptchange" datatype="dept" dataname="科室"
                                    v-model="searchObj.txtreqdept" width="150px"></rm-ddl-common>
                            </td>
                            <td align="right" width="60">所属病区</td>
                            <td>
                                <rm-ddl-common :appendtobody="true" @change="wardchange" datatype="ward" dataname="病区"
                                    v-model="searchObj.txtward" width="140px"></rm-ddl-common>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">申请项目</td>
                            <td>
                                <rm-ddl-common ref="txtreqitem" @change="reqitemchange" datatype="reqitem" dataname="申请项目"
                                    v-model="searchObj.txtreqitem" width="370px" :readonly="true"
                                    :clearable="true"></rm-ddl-common>
                            </td>
                            <td align="right">申请状态</td>
                            <td>
                                <rm-ddl-common ref="txtreqstatus" @change="reqstatchange" datatype="seccode"
                                    kindno="REQ_STAT" dataname="申请状态" v-model="searchObj.txtreqstatus" width="150px"
                                    :readonly="true" :clearable="true"></rm-ddl-common>
                            </td>
                            <td align="right">检验组</td>
                            <td>
                                <rm-ddl-common @change="labgroupchange" datatype="labgroup" dataname="检验工作组"
                                    v-model="searchObj.txtlabgroup" width="150px"></rm-ddl-common>
                            </td>
                            <td align="right">执行科室</td>
                            <td>
                                <rm-ddl-common @change="EXEdeptchange" datatype="dept" dataname="科室"
                                    v-model="searchObj.txtexedept" width="150px"></rm-ddl-common>
                            </td>
                            <td align="right">病人类型</td>
                            <td>
                                <rm-ddl-common ref="txtpattype" @change="pattypechange" datatype="seccode" kindno="PT"
                                    dataname="病人类型" v-model="searchObj.txtpattype" width="150px" :readonly="true"
                                    :clearable="true"></rm-ddl-common>
                            </td>
                        </tr>
                        <tr v-show="is_showselother">
                            <td align="right">分单类别</td>
                            <td>
                                <!-- <rm-ddl-common @change="reqgroupchange" datatype="reqgroup" dataname="分单类别" v-model="searchObj.txtreqgroup" width="100%"></rm-ddl-common> -->
                                <el-select v-model="searchObj.txtreqgroup"
                                    @dblclick.native="popMultipleChk(searchObj.txtreqgroup, 'txtreqgroup', reqgroupOption, '请选择分单类别')"
                                    filterable clearable style="width: 100%">
                                    <el-option v-for="(item, index) in reqgroupOption" :key="index" :value="item.data"
                                        :label="item.display"></el-option>
                                </el-select>
                            </td>
                            <td align="right">床号序号</td>
                            <td>
                                <el-input v-model.trim="searchObj.txtbedno" @keyup.enter.native="InitPage" clearable
                                    style="width: 150px"></el-input>
                            </td>

                            <td align="right">病历号</td>
                            <td>
                                <el-input v-model.trim="searchObj.txtpatno" @keyup.enter.native="InitPage" clearable
                                    style="width: 150px"></el-input>
                            </td>
                            <td align="right">病人姓名</td>
                            <td>
                                <el-input v-model.trim="searchObj.txtpatname" @keyup.enter.native="InitPage" clearable
                                    style="width: 150px"></el-input>
                            </td>
                            <td colspan="2" style="text-align: left">
                                <el-radio-group v-model="searchObj.rdoreqtype">
                                    <el-radio :label="0">输血</el-radio>
                                    <el-radio :label="1">检验</el-radio>
                                    <el-radio :label="2">全部</el-radio>
                                </el-radio-group>
                            </td>
                        </tr>
                        <tr v-show="is_showselother">
                            <td align="right">送检医院</td>
                            <td>
                                <rm-ddl-common @change="hospitalchange" datatype="hospital" dataname="医院"
                                    v-model="searchObj.txthoscode" width="100%"></rm-ddl-common>
                            </td>
                            <td align="right">病人ID</td>
                            <td>
                                <el-input v-model.trim="searchObj.txtpatid" @keyup.enter.native="InitPage" clearable
                                    style="width: 150px"></el-input>
                            </td>
                            <td colspan="8" style="text-align: left">
                                <el-checkbox v-model="searchObj.chkreqgroup" true-label="1"
                                    false-label="0">按分单类别所属工作组查询</el-checkbox>
                                <el-checkbox v-model="searchObj.chklocalRcv" true-label="1"
                                    false-label="0">仅查询本地签收的数据</el-checkbox>
                                <el-checkbox v-model="searchObj.chkOnlyShowRej" true-label="1"
                                    false-label="0">仅显示剔回过的标本</el-checkbox>
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="float: left; width: 100%" class="operation-list">
                    <table style="float: right">
                        <tr>
                            <td>
                                <el-link :underline="false" @click="btn_showselother">{{ is_showselother ? "收起其它条件" :
                                    "展开其它条件" }}<i
                                        :class="is_showselother ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
                                </el-link>
                            </td>
                            <td>
                                <el-button icon="el-icon-search" @click="InitPage" type="primary">查询</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-printer" @click="btnPrintReqList($event)">打印申请单</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-printer" @click="btnPrintBarcode($event)">打印标签</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-printer" @click="btnPrint($event)">打印清单</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-sort" @click="btnSort">排序</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-close" @click="btnClear">清除</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-download" @click="btnExport">导出</el-button>
                            </td>
                            <td>
                                <el-button icon="el-icon-notebook-2" @click="QueryPatCase">查阅病历</el-button>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div :class="!is_showselother ? 'pagecenter' : 'pagecenterother'">
            <div class="middle-center">
                <vxe-table show-overflow ref="xTable1" :height="!is_showselother ? 'auto' : '100%'"
                    :select-config="selectConfig" :data.sync="master" border size="mini" :row-class-name="RowClassName"
                    show-header-overflow highlight-current-row highlight-hover-row resizable stripe
                    @current-change="currentChange" :loading="loading1" class="myclass"
                    :edit-config="{ trigger: 'click', mode: 'cell', showIcon: false }">
                    <vxe-table-column type="selection" width="47" header-align="center" align="center"></vxe-table-column>
                    <vxe-table-column field="recieve_dt" title="签收时间 " width="130" header-align="center"></vxe-table-column>
                    <vxe-table-column field="recieve_username" title="签收人 " width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_groupna" title="分单类别" width="80" header-align="center"></vxe-table-column>
                    <vxe-table-column field="specimen_name" title="标本类型 " width="74"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_deptname" title="申请科室" width="100"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_no" title="病历号 " width="100" header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_wardname" title="病人病区 " width="100"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_bedno" title="床号 " width="64" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_typename" title="病人类型 " width="60" header-align="center"
                        align="center"></vxe-table-column>
                    <vxe-table-column field="pat_name" title="姓名 " width="50" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_sexname" title="性别 " width="40" header-align="center"
                        align="center"></vxe-table-column>
                    <vxe-table-column field="barcode" title="条码号 " width="97" header-align="center"></vxe-table-column>
                    <vxe-table-column field="emer_flag" title="加急 " width="40" header-align="center" align="center">
                        <template v-slot="{ row }">
                            <div style="color: red">{{ row.emer_flag == "1" ? "急" : "" }}</div>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="sample_items" title="项目描述 " width="203"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_agestr" title="年龄" width="45" header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_dt" title="申请时间 " width="120" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="req_docname" title="申请人" width="50" header-align="center"></vxe-table-column>
                    <vxe-table-column field="sampled_username" title="采样人" width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="sampled_dt" title="采样时间" width="121" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="send_username" title="送出人" width="50" header-align="center"></vxe-table-column>
                    <vxe-table-column field="send_dt" title="送出时间" width="96" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="send_user1" title="运送护工" width="50" header-align="center"></vxe-table-column>
                    <vxe-table-column field="send_dt1" title="送达时间" width="96" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="req_statname" title="申请状态" width="70" header-align="center"></vxe-table-column>
                    <vxe-table-column field="reject_reason" title="退回原因" width="125"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="base_amount" title="基准总金额" width="80" header-align="center"
                        align="right"></vxe-table-column>
                    <vxe-table-column field="labadd" title="实验室增加标志" width="85" header-align="center" align="center">
                        <template v-slot="{ row }">
                            <el-checkbox v-model="row.labadd" true-label="1" false-label="0"></el-checkbox>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="create_dt" title="条码生成时间 " width="120" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="create_username" title="条码生成人" width="74"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="print_dt" title="打印日期 " width="126" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="print_username" title="打印人" width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="print_count" title="打印次数 " width="70" header-align="center"
                        align="center"></vxe-table-column>
                    <vxe-table-column field="prereport_dt" title="预出报告时间 " width="98" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="prereport_comm" title="报告领取说明 " width="98"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_diag" title="临床诊断 " width="100" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_id" title="病人唯一号 " width="100" header-align="center"></vxe-table-column>
                    <vxe-table-column field="inp_date" title="入院日期 " width="80" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="recieve_host" title="检验科接收电脑 " width="115"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="prereport_dt1" title="预出报告时间1" width="100" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="charge_dt" title="计价时间" width="120" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="charge_username" title="计价人" width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="amount" title="实收总金额" width="80" header-align="center"
                        align="right"></vxe-table-column>
                    <vxe-table-column field="charge_flag" title="收费标志" width="63" header-align="center"
                        align="center"></vxe-table-column>
                    <vxe-table-column field="test_dt" title="上机时间" width="120" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="test_username" title="上机人" width="50" header-align="center"></vxe-table-column>
                    <vxe-table-column field="report_dt" title="报告时间" width="120" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd HH:mm:ss']"></vxe-table-column>
                    <vxe-table-column field="report_username" title="检验医生姓名" width="80"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="rechk_username" title="审核医生姓名" width="80"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="alter_flag" title="警告" width="45" header-align="center">
                        <template v-slot="{ row }">
                            <div>{{ row.alter_flag == "1" ? "警" : "" }}</div>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="pat_cardno" title="就诊卡号 " width="109" header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_comm" title="医生备注 " width="197" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_birth" title="病人生日 " width="80" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <!-- <vxe-table-column field="pat_ageyear" title="年龄岁数 " width="70" header-align="center"></vxe-table-column> -->
                    <vxe-table-column field="inp_id" title="住院标识 " width="60" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_diag_icd" title="诊断的ICD10编码 " width="121"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_address" title="病人联系地址 " width="145"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_nation" title="国家/民族 " width="84" header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_idcardno" title="身份证号护照号 " width="127"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="pat_phone" title="联系电话 " width="84" header-align="center"></vxe-table-column>
                    <vxe-table-column field="charge_typename" title="收费类型 " width="82" header-align="center"
                        :edit-render="{ name: 'select', options: $opt.chargeOption }"></vxe-table-column>
                    <vxe-table-column field="perform_deptname" title="执行科室 " width="83"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_wardno" title="病区代码 " width="82" header-align="center"></vxe-table-column>
                    <vxe-table-column field="original_reqno" title="原始单号 " width="90"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="secrecy" title="加密标志 " width="77" header-align="center"></vxe-table-column>
                    <vxe-table-column field="other_stat" title="备用标志 " width="76" header-align="center"></vxe-table-column>
                    <vxe-table-column field="cancel_dt" title="作废时间 " width="125" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="cancel_username" title="作废人" width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="reject_count" title="退回次数" width="70" header-align="center"
                        align="right"></vxe-table-column>
                    <vxe-table-column field="specimen_code" title="标本类型代码" width="90"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="sample_detail" title="标本备注说明" width="101"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_reason" title="送检目的" width="107" header-align="center"></vxe-table-column>
                    <vxe-table-column field="reject_username" title="退回人" width="50"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="reject_dt" title="退回时间 " width="90" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="saleman" title="所属销售人" width="73" header-align="center"></vxe-table-column>
                    <vxe-table-column field="master_barcode" title="主申请单号" width="93"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="multi_seq" title="多条码序号" width="80" header-align="center"></vxe-table-column>
                    <vxe-table-column field="req_groupid" title="分单类别ID" width="80"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="report_id" title="报告单ID " width="81" header-align="center"></vxe-table-column>
                    <vxe-table-column field="report_user" title="检验医生代码" width="81"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="rechk_user" title="审核医生代码" width="80" header-align="center"></vxe-table-column>
                    <vxe-table-column field="recieve1_dt" title="工作组接收时间 " width="129" header-align="center"
                        :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                    <vxe-table-column field="recieve1_username" title="工作组接收人 " width="109"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="labgroupid" title="签收工作组" width="80" header-align="center"></vxe-table-column>
                    <vxe-table-column field="inlib_status" title="入库状态" width="82" header-align="center"></vxe-table-column>
                    <vxe-table-column field="library_id" title="所在库位ID" width="82" header-align="center"></vxe-table-column>
                    <vxe-table-column field="reqtype" title="业务" width="50" header-align="center"
                        :edit-render="{ name: 'select', options: $opt.reqtype }" align="center"></vxe-table-column>
                    <vxe-table-column field="pat_height" title="身高" width="65" header-align="center"></vxe-table-column>
                    <vxe-table-column field="weight" title="体重" width="71" header-align="center"></vxe-table-column>
                    <vxe-table-column field="abo_bldtype" title="ABO血型 " width="90"
                        header-align="center"></vxe-table-column>
                    <vxe-table-column field="rh_bldtype" title="RH血型 " width="94" header-align="center"></vxe-table-column>
                    <vxe-table-column field="recieveaddr" title="签收点 " width="125" header-align="center"></vxe-table-column>
                    <vxe-table-column field="hospname" title="送检医院 " width="183" header-align="center"></vxe-table-column>
                </vxe-table>
                <div class="table-bottom">
                    <div
                        style="font-size: 17px; padding-left: 3px; background-color: #fff; overflow: auto; text-align: center">
                        <span style="font-weight: bold; margin-left: 18px; color: blue">共计：{{ dataSum }}&nbsp;&nbsp;已选：{{
                            dataChkSum }}</span>
                    </div>
                </div>
            </div>
        </div>
        <!--多选弹窗--->
        <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择分单类别"
            :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
            <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname"
                @change="closedialog"></rm-SqlMultiple>
        </el-dialog>
    </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
export default {
    name: "LIS217",
    data() {
        return {
            loading1: false,
            dialogMultipleVisible: false,
            searchObj: {
                rcv_startdt: this.$pub.InitDateTime2(0).datefrom,
                rcv_enddt: this.$pub.InitDateTime2(0).dateto,
                txtbarcode: "",
                txtpatno: "",
                txtpatname: "",
                txtexedept: "",
                txtreqdept: "",
                txtreqitem: "",
                txtward: "",
                txtlabgroup: "",
                txtbedno: "",
                txtuser: "",
                txtreqstatus: "",
                txtreqgroup: "",
                txtpattype: "",
                txthoscode: "",
                rdoreqtype: 2,
                chkreqgroup: "0",
                chklocalRcv: "0",
                chkOnlyShowRej: "0",
            },
            txtreqdeptname: "",
            txtexedeptname: "",
            txtwardname: "",
            txtreqitemname: "",
            txtusername: "",
            txthosname: "",
            txtusergroupname: "",
            txtbarcodegroupname: "",
            txtreqgroupname: "",
            txtlabgroupname: "",
            txtspecimenname: "",
            txtreqstatusname: "",
            txtpattypename: "",
            master: [],
            keyConfig: {
                isDel: true,
                isTab: true,
                isEdit: false,
            },
            keyLocalConfig: {
                isArrow: true,
            },
            selectConfig: { tigger: "row", checkAll: true, reserve: true },
            sortArr: [],
            tableColumn: [],
            selectRow: [],
            reqgroupOption: [],
            is_showselother: false,
            userno: this.$tool.getSession(this.$tool.loginuserno),
            rcvliststyleid: "",
            fieldname: "",
            option1: [],
            option2: [],
        };
    },
    created() {
        this.InitOption();
        //this.InitPage(); //初始化主列表
    },
    mounted() {
        this.$refs.searchbarcode.focus();
    },
    updated() { },
    computed: {
        dataSum() {
            return this.master.length;
        },
        dataChkSum() {
            if (this.dataSum > 0) {
                let data = this.$refs.xTable1.getSelectRecords();
                return data.length;
            } else {
                return 0;
            }
        },
    },
    methods: {
        popMultipleChk(e, fieldname, option, title) {
            let temp = XEUtils.clone(option, true);
            this.option1 = [];
            this.option2 = [];
            if (e != "") {
                let k = e.split(",");
                k.forEach((item) => {
                    let ndata = temp.find((m) => m.data == item);
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata);
                    }
                });
                temp.forEach((item) => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item);
                    }
                });
            } else {
                this.option1 = temp;
            }
            this.fieldname = fieldname;
            this.multichktitle = title;
            this.dialogMultipleVisible = true;
        },
        closedialog(value, name) {
            this.searchObj[name] = value;
            this.dialogMultipleVisible = false;
        },
        initColumns() {
            if (this.tableColumn.length == 0) {
                let columns = this.$refs.xTable1.getColumns();
                columns.forEach((item) => {
                    this.tableColumn.push({ title: item.title, field: item.property });
                });
            }
        },
        InitPage(showtype) {
            this.loading1 = true;
            this.$tool
                .request({
                    url: "LIS/LIS2/LIS217",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "InitPage",
                        sortArr: this.sortArr,
                        ...this.searchObj,
                    },
                })
                .then((res) => {
                    if (res.data.length > 0) {
                        this.master = res.data;
                        this.$refs.xTable1.setCurrentRow(res.data[0]);
                        this.selectRow = res.data[0];
                    } else {
                        this.$refs.xTable1.setCurrentRow(null);
                        this.master = [];
                    }
                    if (res.rowcount >= 5000) {
                        this.$alert("当前仅显示5000行", "提示");
                    }
                    this.rcvliststyleid = res.rcvliststyleid;
                    this.reqliststyleid = res.reqliststyleid;
                    if (!showtype) this.is_showselother = false;
                    this.initColumns(); //初始化列名
                    this.loading1 = false;
                })
                .catch((err) => {
                    this.loading1 = false;
                });
        },
        InitOption() {
            this.$tool
                .request({
                    url: "LIS/LIS2/LIS217",
                    method: "post",
                    data: {
                        action: "InitOption",
                    },
                })
                .then((res) => {
                    this.reqgroupOption = res.reqgroupOption;
                    this.searchObj.txthoscode = res.secHospCode;
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        btnSort() {
            this.$rmsort(
                { tableColumn: this.tableColumn, sortArr: this.sortArr },
                {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                }
            )
                .then((res) => {
                    this.sortArr = res.data;
                    this.InitPage();
                })
                .catch(() => { });
        },
        btnClear() {
            this.searchObj = {
                rcv_startdt: this.$pub.InitDateTime2(0).datefrom,
                rcv_enddt: this.$pub.InitDateTime2(0).dateto,
                txtbarcode: "",
                txtpatno: "",
                txtpatname: "",
                txtexedept: "",
                txtreqdept: "",
                txtreqitem: "",
                txtward: "",
                txtlabgroup: "",
                txtbedno: "",
                txtuser: "",
                txtreqstatus: "",
                txtreqgroup: "",
                txtpattype: "",
                txthoscode: "",
                rdoreqtype: 2,
                chkreqgroup: "0",
                chklocalRcv: "0",
                chkOnlyShowRej: "0",
            };
            this.master = [];
            this.sortArr = [];
        },
        async btnPrintBarcode(e) {
            let barcode = "";
            let data = this.$refs.xTable1.getSelectRecords();
            if (data.length > 0) {
                data.forEach((item) => {
                    barcode += item.barcode + ",";
                });
                barcode = barcode.substring(0, barcode.length - 1);
            } else {
                this.$message.warning("请选择要打印的标签！");
                return false;
            }
            let printinfo = await this.$tool.request({ url: "ucent/print", method: "post", data: { action: "testprint" } });
            this.$pub.printbarcode(this, barcode, "1", printinfo.barstyle, printinfo.barcodepname, "1");

            this.$refs.searchbarcode.select();
        },
        btnPrint(e) {
            if (!this.rcvliststyleid) {
                this.$alert("请检查是否设置签收清单样式！");
                return false;
            }
            if (e.shiftKey) {
                //调整
                //
                let sql = "select top 1 * from req_master_all_name";
                this.$pub.printlistbill(this, sql, "3", this.rcvliststyleid, "退回清单样式", "");
            } else {
                //打印
                let data = this.$refs.xTable1.getSelectRecords();
                let barcode = "";
                data.forEach((item) => {
                    if (barcode == "") {
                        barcode = item.barcode;
                    } else {
                        barcode = barcode + "','" + item.barcode;
                    }
                });
                let sql = "select * from req_master_all_name where 条码号 in ('" + barcode + "')";
                this.$pub.printlistbill(this, sql, "1", this.rcvliststyleid, "退回清单样式", "");
            }
            this.$refs.searchbarcode.select();
        },
        btnPrintReqList(e) {
            if (!this.reqliststyleid) {
                this.$alert("请检查是否设置了检验申请单样式！");
                return false;
            }
            this.$refs.searchbarcode.select();
            if (e.shiftKey) {
                //调整在选项
                let sql = "select top 1 * from req_master_all_name";
                this.$pub.printlistbill(this, sql, "3", this.reqliststyleid, "检验申请单样式", "");
            } else {
                //打印
                let data = this.$refs.xTable1.getSelectRecords();
                if (data.length > 0) {
                    let barcode = "";
                    let cnt = data.length;
                    data.forEach((item) => {
                        if (barcode == "") {
                            barcode = item.barcode;
                        } else {
                            barcode = barcode + "','" + item.barcode;
                        }
                    });
                    let sql = "select * from req_master_all_name where 条码号 in ('" + barcode + "')";
                    this.$pub.printlistbill(this, sql, "1", this.reqliststyleid, "检验申请单样式", "");
                } else {
                    this.$alert("请选择要打印的申请单！");
                }
            }
        },
        btnExport() {
            let filtertxt = this.getExportFilter();
            this.$pub.exportTableExcel(this.master, this.tableColumn, "LIS217标本签收查询.xlsx", filtertxt);
        },
        // 获取当前导出文件的所有查询条件
        getExportFilter() {
            let filtertxt = "签收时间:" + XEUtils.toDateString(this.searchObj.rcv_startdt, "yyyy-MM-dd HH:mm:ss") + "至" + XEUtils.toDateString(this.searchObj.rcv_enddt, "yyyy-MM-dd HH:mm:ss") + "; ";
            if (this.searchObj.txtuser) filtertxt += "签收用户:" + this.txtusername + "; ";
            if (this.searchObj.txtbarcode) filtertxt += "条码号:" + this.searchObj.txtbarcode + "; ";
            if (this.searchObj.txtreqdept) filtertxt += "申请科室:" + this.txtreqdeptname + "; ";
            if (this.searchObj.txtward) filtertxt += "所属病区:" + this.txtwardname + "; ";
            if (this.searchObj.txtreqitem) filtertxt += "申请项目:" + this.txtreqitemname + "; ";
            if (this.searchObj.txtreqstatus) filtertxt += "申请状态:" + this.txtreqstatusname + "; ";
            if (this.searchObj.txtlabgroup) filtertxt += "检验组:" + this.txtlabgroupname + "; ";
            if (this.searchObj.txtexedept) filtertxt += "执行科室:" + this.txtexedeptname + "; ";
            if (this.searchObj.txtpattype) filtertxt += "病人类型:" + this.txtpattypename + "; ";
            if (this.searchObj.txtreqgroup) filtertxt += "分单类别:" + this.getOptionName(this.reqgroupOption.filter((item) => ("," + this.searchObj.txtreqgroup + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.searchObj.txtbedno) filtertxt += "床号序号:" + this.searchObj.txtbedno + "; ";
            if (this.searchObj.txtpatno) filtertxt += "病历号:" + this.searchObj.txtpatno + "; ";
            if (this.searchObj.txtpatname) filtertxt += "病人姓名:" + this.searchObj.txtpatname + "; ";
            if (this.searchObj.rdoreqtype) filtertxt += "申请类别:" + (this.searchObj.rdoreqtype == 1 ? "检验" : this.searchObj.rdoreqtype == 0 ? "输血" : "全部") + "; ";
            if (this.searchObj.txthoscode) filtertxt += "送检医院:" + this.txthosname + "; ";
            if (this.searchObj.txtpatid) filtertxt += "病人ID:" + this.searchObj.txtpatid + "; ";
            if (this.searchObj.chkreqgroup == "1") filtertxt += "按分单类别所属工作组查询; "
            if (this.searchObj.chklocalRcv == "1") filtertxt += "仅查询本地签收的数据; "
            if (this.searchObj.chkOnlyShowRej == "1") filtertxt += "仅显示剔回过的标本; "
            return filtertxt;
        },
        getOptionName(option) {
            if (option && option.length > 0) {
                let optionname = "";
                option.forEach((item) => {
                    if (item.hasOwnProperty("display")) {
                        optionname += item.display + ",";
                    } else {
                        optionname += item.label + ",";
                    }
                });
                return optionname.substring(0, optionname.length - 1);
            } else {
                return "";
            }
        },
        currentChange({ row, column }) {
            this.selectRow = row;
        },
        QueryPatCase() {
            this.$pub.getPatcase(this, this.selectRow.barcode, 2);
        },
        RowClassName({ row }) {
            return this.$pub.getreqstatclass(row.req_stat);
        },
        btn_showselother() {
            this.is_showselother = !this.is_showselother;
        },
        REQdeptchange(code, name) {
            this.searchObj.txtreqdept = code;
            this.txtreqdeptname = name;
            this.InitPage();
        },
        EXEdeptchange(code, name) {
            this.searchObj.txtexedept = code;
            this.txtexedeptname = name;
            this.InitPage();
        },
        wardchange(code, name) {
            this.searchObj.txtward = code;
            this.txtwardname = name;
            this.InitPage();
        },
        reqitemchange(code, name) {
            this.searchObj.txtreqitem = code;
            this.txtreqitemname = name;
            this.InitPage();
        },
        userinfochange(code, name) {
            this.searchObj.txtuser = code;
            this.txtusername = name;
            this.InitPage();
        },
        hospitalchange(code, name) {
            this.searchObj.txthoscode = code;
            this.txthosname = name;
            //送检医院在折叠部分，选择后会把自己折叠了
            this.InitPage(true);
        },
        labgroupchange1(code, name) {
            this.searchObj.txtusergroup = code;
            this.txtusergroupname = name;
            this.InitPage();
        },
        labgroupchange2(code, name) {
            this.searchObj.txtbarcodegroup = code;
            this.txtbarcodegroupname = name;
            this.InitPage();
        },
        labgroupchange(code, name) {
            this.searchObj.txtlabgroup = code;
            this.txtlabgroupname = name;
            this.InitPage();
        },
        specimenchange(code, name) {
            this.searchObj.txtspecimen = code;
            this.txtspecimenname = name;
            this.InitPage();
        },
        reqstatchange(code, name) {
            this.searchObj.txtreqstatus = code;
            this.txtreqstatusname = name;
            this.InitPage();
        },
        pattypechange(code, name) {
            this.searchObj.txtpattype = code;
            this.txtpattypename = name;
            this.InitPage();
        },
    },
};
</script>

<style scoped>
.pagetop {
    width: 100%;
    left: 0;
    right: 0;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
    height: 105px;
    overflow-x: auto;
    overflow-x: overlay;
}

.pagecenter {
    position: absolute;
    top: 110px;
    width: 100%;
    left: 0px;
    bottom: 0px;
    overflow: auto;
}

.middle-center {
    position: absolute;
    height: 100%;
    left: 0px;
    right: 0px;
    overflow: auto;
}

table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}

.table1style tr td {
    padding: 0px 2px 0px 2px;
}

::v-deep .myclass .vxe-table .vxe-footer--row.row-blue {
    background-color: #187;
    color: #fff;
}

.pagetopother {
    /* width: 100%;
    height: 155px;
    display: -webkit-box;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    border: 1px solid #ccc;
    position: absolute;
    z-index: 929;*/
    width: 100%;
    left: 0;
    right: 0;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
    height: 165px;
    overflow-x: auto;
    overflow-x: overlay;
}

.pagecenterother {
    position: absolute;
    top: 170px;
    width: 100%;
    left: 0px;
    bottom: 0px;
    overflow: auto;
}

::-webkit-scrollbar {
    width: 0px;
    height: 5px;
    border: 4px solid white;
}

::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
}

::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}

/* Buttons */
::-webkit-scrollbar-button:single-button {
    background-color: #bbbbbb;
    display: block;
    border-style: solid;
    height: 5px;
    width: 5px;
}

/* Left */
::-webkit-scrollbar-button:horizontal:decrement {
    margin-right: 2px;
    border-width: 4px 4px 4px 0;
    border-color: #f1f1f1 transparent #f1f1f1 #f1f1f1;
    background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:decrement:hover {
    border-color: #d2d2d2 transparent #d2d2d2 #d2d2d2;
}

/* Right */
::-webkit-scrollbar-button:horizontal:increment {
    margin-left: 2px;
    border-width: 4px 0 4px 4px;
    border-color: #f1f1f1 #f1f1f1 #f1f1f1 transparent;
    background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:increment:hover {
    border-color: #d2d2d2 #d2d2d2 #d2d2d2 transparent;
}

.operation-list {
    float: right;
    margin-right: 5px;
    margin-bottom: 5px;
}
.table-bottom {
    position: absolute;
    left: 0px;
    bottom: 0%;
    z-index: 1;
    overflow: hidden;
    width: 100%;
}
</style>